feat(opencode): add OpenCode Go quota tracking provider - #109
Conversation
Rebuild PR work cleanly from upstream (keeps kimi/moonshot/deepseek). Hardened scrape client, tracker wiring, typed errors, dashboard/UI, limit-field contract test, and empty-state/history frontend fixes. Co-authored-by: Cursor <cursoragent@cursor.com>
Prevent DetectCodexCredentials from reading the host OpenCode auth.json when CODEX_HOME auth is empty. Co-authored-by: Cursor <cursoragent@cursor.com>
Pin OPENCODE_HOME to a temp dir in tests so host auth.json cannot leak on macOS. Add menubar/tab/historyBoth/settings and document OPENCODE_GO_* in .env.example.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Thanks for the clean rebuild - this follows the provider pattern well and the
|
Co-Authored-By: codex <codex@openai.com>
9f57209 to
ae5c59c
Compare
|
@prakersh Thanks for the detailed review!! I’ve fixed all five points in
Added regression coverage for each case. The targeted race-enabled tracker suite passes. |
prakersh
left a comment
There was a problem hiding this comment.
Re-reviewed - all five points are properly addressed, each with regression coverage. Nice work.
- Redirects:
ErrUseLastResponse+ 3xx→unauthorized, and the test asserts the redirect target gets zero hits, so the cookie never travels down the chain. - Reset drift: the 90-minute tolerance plus the
currentResetIsFutureguard absorbs hour-granularity noise, and genuine resets are still caught by the api-based branch since those jump 5h/7d. - Hermetic tests: the remaining real-client uses are missing-config paths that return before any HTTP call.
- Cookie prefix and quota-set re-render both look right.
Verified locally on your branch merged with current main (v2.13.2): clean merge, go vet clean, go test -race ./... green across all packages. CI is green too.
Merging as a squash - main requires linear history. Thanks for the thorough follow-up, and for rebuilding this cleanly after #102.
Adds the OpenCode Go provider merged in #109 (thanks @hiyukoim): 5-hour / weekly / monthly subscription quota tracking scraped from the authenticated OpenCode Go dashboard, with cycle history, deep insights, menubar card, and settings UI. Docs: - README: OpenCode Go provider bullet + OPENCODE_GO_* env var rows - CLAUDE.md: refresh stale provider count (9 -> 15) and setup-doc list
Summary
Replaces closed #102 since it got messy. Rebuilds OpenCode Go as a quota provider on current
upstream/main(keeps Kimi / Moonshot / DeepSeek), following the existing provider pattern from CONTRIBUTING.md. Related: #100.OPENCODE_GO_WORKSPACE_ID+OPENCODE_GO_AUTH_COOKIE(seedocs/OPENCODE_SETUP.md)OPENCODE_ENABLEDremains the separate Codex-via-OpenCode-auth pathlimit(notlimitValue); empty-state re-render guarded; dedicated history routingWhy a new PR
#102 was closed after an unrelated-histories merge onto the harden branch corrupted history /
app.js. This branch starts clean fromupstream/mainand ports OpenCode-only changes.Provider checklist
Per CONTRIBUTING "Adding a New Provider":
internal/api/opencode*.gointernal/store/opencode_store.go(+ schema instore.go)internal/tracker/opencode_tracker.gointernal/agent/opencode_agent.gointernal/web/handlers.go/opencode_handlers.gointernal/web/static/app.jsTest plan
api,web,agent,store,tracker,configgo vet ./...OPENCODE_GO_WORKSPACE_ID+OPENCODE_GO_AUTH_COOKIEset: OpenCode tab appears, quotas poll, charts update./app.sh --smoke # optional full suite: ./app.sh --test